"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const redux_1 = require("@tarojs/redux");
const taro_1 = require("@tarojs/taro");
const components_1 = require("@tarojs/components");
const HomeContent_1 = require("../../../containers/HomeContent");
const goods_1 = require("../../../actions/goods");
require("./index.scss");
let MyGoods = class MyGoods extends taro_1.default.Component {
    constructor() {
        super(...arguments);
        this.config = {
            navigationBarTitleText: '全部抽奖'
        };
        this.handleToPage = msg => {
            msg.stopPropagation();
            taro_1.default.navigateTo({
                url: '/pages/profile/index'
            });
        };
        this.state = {
            status: 0,
        };
    }
    componentWillMount() {
        const params = this.$router.params ? this.$router.params : {};
        const userInfo = taro_1.default.getStorageSync('userInfo');
        console.log(userInfo, 'userInfo');
        this.setState(state => (Object.assign({}, state, params)), () => {
            // 初始化数据
            this.props.fetchList({ userId: userInfo.userId, status: 0 });
        });
    }
    render() {
        return (<components_1.View className='bg'>
      {(this.props.goods.data.data && this.props.goods.data.data.length > 0)
            ?
                this.props.goods.data.data.map((row) => <HomeContent_1.default queryRow={row} key={row.id} onClick={this.handleToPage}/>)
            :
                <components_1.View style={{ textAlign: 'center' }}>暂无全部抽奖</components_1.View>}
      </components_1.View>);
    }
};
MyGoods = __decorate([
    redux_1.connect(({ goods }) => ({
        goods
    }), (dispatch) => ({
        fetchList(params) {
            dispatch(goods_1.queryList(params));
        }
    }))
], MyGoods);
exports.default = MyGoods;
//# sourceMappingURL=index.jsx.map